use meps


ALTER USER sms WITH LOGIN = sms;
ALTER USER SoapGate WITH LOGIN = SoapGate;

create USER Terminal for LOGIN  Terminal;
CREATE ROLE [TerminalRole] AUTHORIZATION [dbo]
EXEC dbo.sp_addrolemember @rolename=N'TerminalRole', @membername=N'Terminal'
EXEC dbo.sp_addrolemember @rolename=N'Browser', @membername=N'Terminal'
grant insert on AutomatLogW to TerminalRole;
grant insert on AutomatLog to TerminalRole;
grant update on AutomatLog to TerminalRole;
grant update on Automats to TerminalRole;
grant insert on WorkStatus to TerminalRole;
grant insert on Automats to TerminalRole;




create USER RegClaimer for LOGIN  RegClaimer;
EXEC dbo.sp_addrolemember @rolename=N'Browser', @membername=N'RegClaimer'

GRANT INSERT ON Automats TO RegClaimer;
GRANT SELECT ON AutomatLogW TO RegClaimer;
GRANT UPDATE ON AutomatLogW TO RegClaimer;
GRANT INSERT ON AutomatLogW TO RegClaimer;

create USER Registrator for LOGIN  Registrator;
EXEC dbo.sp_addrolemember @rolename=N'Browser', @membername=N'Registrator'
GRANT UPDATE ON Automats TO Registrator;
